#include <stdio.h>
#include <unistd.h>
#include <time.h>

int main(){
    struct timespec a1;
    struct timespec a2;
    a1.tv_nsec = 0;
    a1.tv_sec = 0;
    a2.tv_nsec = 0;
    a2.tv_sec = 0;

    clock_gettime(CLOCK_REALTIME, &a1);
    for(int i = 0; i < 1000000; i++){
        for(int j = 0; j < 10000; j++){
            ;
        }
    }

    clock_gettime(CLOCK_REALTIME, &a2);

    printf("a1 is %ld seconds and %ld nanoseconds\n", a1.tv_sec, a1.tv_nsec);
    printf("a2 is %ld seconds and %ld nanoseconds\n", a2.tv_sec, a2.tv_nsec);
}   